Skip to main content
This guide provides the technical specifications and reference implementation required to integrate Lyzr’s low-latency voice AI into external applications.

1. Authentication & Endpoint

All requests to the Lyzr Voice API require an x-api-key header containing your organization’s API key.
  • Production Base URL: https://voice-livekit.studio.lyzr.ai
  • Authentication Header: x-api-key: <YOUR_LYZR_API_KEY>

2. Integration Flow

The integration follows a four-step lifecycle: session initialization, WebRTC connection, active streaming, and cleanup.

Step 1: Start a Session

Initialize a session via a REST call. This dispatches a voice agent to a unique room and generates access credentials for the client.
  • Endpoint: POST /v1/session/start
  • Request Body:
  • Response: Returns a userToken, roomName, and url (LiveKit server URL).

Step 2: Connect to Agent Room

Use the returned url and userToken to join the real-time session using a LiveKit compatible SDK.

Step 3: Stream Audio

Once the connection is established, publish your local microphone track. The agent will automatically subscribe to your audio and respond with high-fidelity audio and transcription data events.

Step 4: End Session

To ensure the agent is successfully released and resources are cleaned up, explicitly terminate the session.
  • Endpoint: POST /v1/session/end
  • Body: { "roomName": "the-room-name-from-step-1" }

3. Reference Implementation (React/TypeScript)

The following implementation snippets provide a robust foundation for integrating the voice agent into a web application.

A. API Client Configuration

This wrapper ensures all calls are authenticated and pointed to the correct production environment.

B. Background Audio Renderer

Lyzr agents publish a dedicated track named background_audio for ambient noise and “thinking” sound effects. Because standard room renderers often ignore unknown track names, you must manually attach this track to an audio element.

C. Unified Voice Widget Setup

This component handles the lifecycle from “Ready to Connect” to an “Active Session.”

For more

To see an end-to-end example, see the Voice Agent cookbook.